{% load i18n %}
<script>

    // 前端模板里面为什么这个会失效，一开始是可以的, 只能自己控制了
    function init_deposites_collapse()
    {
        var open_id = []
        $('.deposites_listen').on('show.bs.collapse', function () {
            // 简单处理，之前的都关闭
            var id =  $(this).attr('id');
            for(var i=0; i<open_id.length; i++) {
                $("#" + open_id[i]).removeClass("in")
            }
            open_id = [id]
        })
    }
</script>
<script id="temp_deposites" type="text/html">
    <div class="context-body f-pz">
        <div class="panel-group" id="accordion2">
            <table class="table table-hover ">
                <thead>
                <tr class="bg-white ">
                    <th><%=$imports.gettext('时间')%></th>
                    <th><%=$imports.gettext('币种')%></th>
                    <th class="col-sm-2"><%=$imports.gettext('类型')%></th>
                    <th><%=$imports.gettext('数量')%></th>
                    <th>
                        <div><%=$imports.gettext('状态')%></div>
                    </th>
                    <th>
                        <div><%=$imports.gettext('详情')%></div>
                    </th>
                    <!--
                    <th><%=$imports.gettext('确认数')%></th>
                    -->
                </tr>
                </thead>
                <tbody class="svg_green green">
                <% for(i = 0; i < jsonobj.length; i++) { %>
                <% var info = jsonobj[i] %>
                <% var coin_type = info.coin_type %>
                <% var create_time = $imports.dateFormat(info.create_time) %>
                <% var confirm_time = "" %>
                <% if (info.confirm_time) { %>
                <% confirm_time = $imports.dateFormat(info.confirm_time) %>
                <% } %>
                <% var amount = info.amount * 1 %>
                <% var confirmations = info.confirmations %>
                <% var status1 = info.status %>
                <% var confirm_url_test = "https://www.blocktrail.com/tBTC/tx/" + info.txid %>
                <% var confirm_url = "https://blockchain.info/zh-cn/tx/" + info.txid %>
                <% status = $imports.gettext('等待确认数') %>
                <% if (status1 == 0) { %>
                <% status = $imports.gettext('等待确认数') %>
                <% } else if(status1 == 1) { %>
                <% status = $imports.gettext('充值成功') %>
                <% } else if(status1 == 2) { %>
                <% status = $imports.gettext('充值失败') %>
                <% } %>
                <tr>
                    <td colspan=6>
                        <ul class="list-inline  col-sm-12">
                            <li class="col-sm-2"><%=create_time%></li>
                            <li class="col-sm-2"><img src="/static/images/icon/<%=coin_type%>.png" width="16px" height="16px"/> <b><%=coin_type%></b></li>
                            <li class="col-sm-2">{% trans '充值'%}</li>
                            <li class="col-sm-2"><%=amount%></li>
                            <li class="col-sm-2"><%=status%></li>
                            <li class="col-sm-2"><a data-toggle="collapse" data-parent="#accordion2" href="#deposit_<%=info.id%>">{% trans '详情' %}</a></li>
                        </ul>
                        <div id="deposit_<%=info.id%>" class="panel-collapse collapse deposites_listen">
                            <div class="panel-body ">
                                <table class="col-sm-12 collapse_detail alert-info " role="alert">
                                    <tbody class="collapse_detail ">
                                    <tr>
                                        <td class="col-sm-6 f-left"><span>{% trans '到账时间' %}</span>:<span><%=confirm_time%></span></td>
                                        <td class="col-sm-6 f-left"><span>{% trans '充值地址' %}</span>:<span><%=info.address%></span></td>
                                    </tr>

                                    <tr>
                                        <!-- 确认数有用在于没有加入之前 -->
                                        <td class="col-sm-6 f-left"><span>{% trans '区块链交易id' %}</span>:<span><%=info.txid%></span></td>
                                        <td class="f-left col-sm-6"></td>
                                        <!--
                                        <td class="f-left col-sm-6"><span>{% trans '确认数' %}</span>:<span><%=fee%></span></td>
                                        -->
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </td>
                </tr>
                <% } %>
                </tbody>
            </table>
        </div>
    </div>
</script>
